import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
//https://www.nowcoder.com/questionTerminal/2d3f6ddd82da445d804c95db22dcc471?orderByHotValue=1&page=1&onlyReference=false
public class Main_paixuzixulie {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int len = scan.nextInt() ;
        int[] dp = new int[len+1] ; 
        for(int i=0 ; i < len ; i ++){
            dp[i] = scan.nextInt() ;
        }
        int count = 0 ; 
        int i = 0 ; 
        while(i < len){
            if(dp[i] > dp[i+1]){
              while(i < len && dp[i]> dp[i+1]){
                i++ ;
              }  
              i ++ ;
             count ++ ;
            }else if(dp[i] < dp[i+1]){
               while(i < len && dp[i] < dp[i+1]){
                i++ ;
              }  
              i ++ ;
             count ++ ;
            }else{
                i ++ ;
            }
        }
        System.out.println(count) ; 
    }
}